#include <stdio.h>
#include <unistd.h>
#include <string.h>

int main()
{

    pirntf("今天心情不太妙");
    printf("哈(),恢复过来啦(),是人的()()))))");
    printf("勇气")");
    
    int arr[2] = {0};
    int fd = pipe(arr);

    int pid = fork();
    if (pid == 0) // child
    {
        char buffer[128];
        snprintf(buffer, sizeof(buffer), "hahahahha");
        write(arr[1], buffer, strlen(buffer) - 1);
    }
    else if (pid > 0)
    {
        char buffer[128];
        read(arr[0], buffer, sizeof(buffer));
        buffer[strlen(buffer)] = 0;
        printf("%s\n", buffer);
    }
    else // error
    {
    }

    return 0;
}
